Reject invalid usernames from Votifier votes - #1533
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3f089f02b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| public final class MinecraftUsernameValidator { | ||
| private static final int MAX_LENGTH = 16; | ||
| private static final int MAX_LOG_LENGTH = 32; | ||
| private static final Pattern VALID_USERNAME = Pattern.compile("[A-Za-z0-9_]{1," + MAX_LENGTH + "}"); |
There was a problem hiding this comment.
Allow the configured Bedrock prefix
When the documented default BedrockPlayerPrefix: '.' is used, a valid Bedrock vote such as .Player fails this Java-only pattern, so both new ingress checks reject it before the existing Bedrock-aware resolution runs; proxy cache or multi-proxy replays containing the resolved prefixed name are rejected as well. Recognize and validate the configured prefix plus base name, or delegate validation to the existing Bedrock-aware validation path.
Useful? React with 👍 / 👎.
Summary
Reject invalid Minecraft usernames at the earliest VotingPlugin vote-ingress boundaries before any UUID generation or state mutation.
Valid Java Edition-style usernames continue to accept 1-16 ASCII letters, digits, and underscores, including previously unknown offline players and the exact 16-character value
MchtNameOver16xx.Root cause
Proxy offline mode resolved an offline UUID before validating the externally supplied Votifier username. Values containing traversal syntax, slashes, whitespace, punctuation, Unicode, controls, or more than 16 characters could therefore reach MySQL totals, vote caches, rewards, and backend/proxy forwarding.
Changes
MinecraftUsernameValidatorusing[A-Za-z0-9_]{1,16}.VotingPluginProxy.vote(...)boundary used by BungeeCord, Velocity, and multi-proxy vote replay.PlayerVoteEventprocessing.Validation
git diff --check— passed.MCHT follow-up
The MCHT harness is maintained outside this repository. Its invalid-length fixture must change from the valid 16-character
MchtNameOver16xxto the genuine 17-characterMchtNameOver16xxxbefore the next MCHT run.